package testing.strutturale;

import static org.junit.Assert.*;

import jsudoku.Sudoku;
import jsudoku.exception.InvalidSudokuException;

import org.junit.Test;

public class testisResolvedSudoku {

	
			
			//Test 0bis: matrice con uno 0 nel gruppo e CORRETTA!
			@Test
			public void testisResolvedSudoku0bis() throws InvalidSudokuException {
				int[][] matrice = {
						
						{6, 8, 4, 5, 7, 2, 9, 1, 3},
						{9, 3, 2, 8, 6, 1, 7, 5, 4},
						{5, 1, 0, 9, 4, 3, 6, 8, 2},
						{3, 4, 9, 2, 5, 8, 1, 6, 7},
						{1, 6, 8, 3, 9, 7, 4, 2, 5},
						{7, 2, 5, 6, 1, 4, 8, 3, 9},
						{4, 7, 3, 1, 2, 6, 5, 9, 8},
						{2, 5, 1, 4, 8, 9, 3, 7, 6},
						{8, 9, 6, 7, 3, 5, 2, 4, 1}
						
				};
				
				Sudoku s = new Sudoku(matrice);
				assertFalse(s.isResolvedSudoku());
			}
			
	
			
		//Test 1: matrice completa con 1 errore nel primo gruppo
		@Test
		public void testisResolvedSudoku1() throws InvalidSudokuException {
			int[][] matrice = {
					
					{6, 8, 4, 5, 7, 2, 9, 1, 3},
					{9, 3, 2, 8, 6, 1, 7, 5, 4},
					{5, 7, 7, 9, 4, 3, 6, 8, 2},
					{3, 4, 9, 2, 5, 8, 1, 6, 7},
					{1, 6, 8, 3, 9, 7, 4, 2, 5},
					{7, 2, 5, 6, 1, 4, 8, 3, 9},
					{4, 7, 3, 1, 2, 6, 5, 9, 8},
					{2, 5, 1, 4, 8, 9, 3, 7, 6},
					{8, 9, 6, 7, 3, 5, 2, 4, 1}
					
			};
			
			Sudoku s = new Sudoku(matrice);
			assertFalse(s.isResolvedSudoku());
		}
		/*
		//Test 2: matrice completa con 1 errore nel secondo gruppo
				@Test
				public void testisResolvedSudoku2() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 7, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				*/
				//Test 3: matrice completa con 1 errore nel terzo gruppo
				@Test
				public void testisResolvedSudoku3() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 1},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				/*
				//Test 4: matrice completa con 1 errore nel quarto gruppo
				@Test
				public void testisResolvedSudoku4() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{3, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				
				//Test 5: matrice completa con 1 errore nel quinto gruppo
				@Test
				public void testisResolvedSudoku5() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 9, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				*/
				//Test 6: matrice completa con 1 errore nel sesto gruppo
				@Test
				public void testisResolvedSudoku6() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 8, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				/*
				//Test 7: matrice completa con 1 errore nel settimo gruppo
				@Test
				public void testisResolvedSudoku7() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{8, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				
				//Test 8: matrice completa con 1 errore nel ottavo gruppo
				@Test
				public void testisResolvedSudoku8() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 8, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 4, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}
				*/
				//Test 9: matrice completa con 1 errore nel nono gruppo
				@Test
				public void testisResolvedSudoku9() throws InvalidSudokuException {
					int[][] matrice = {
							
							{6, 8, 4, 5, 7, 2, 9, 1, 3},
							{9, 3, 2, 8, 6, 1, 7, 5, 4},
							{5, 1, 7, 9, 4, 3, 6, 8, 2},
							{3, 4, 9, 2, 5, 8, 1, 6, 7},
							{1, 6, 8, 3, 9, 7, 4, 2, 5},
							{7, 2, 5, 6, 1, 4, 8, 3, 9},
							{4, 7, 3, 1, 2, 6, 5, 9, 8},
							{2, 5, 1, 4, 8, 9, 3, 7, 6},
							{8, 9, 6, 7, 3, 5, 2, 7, 1}
							
					};
					
					Sudoku s = new Sudoku(matrice);
					assertFalse(s.isResolvedSudoku());
				}

}
